﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using Gacn.ControleAlunos.Library.Business;
using System.Runtime.Serialization.Formatters.Binary;

namespace Gacn.ControleAlunos.WebApplication
{
    public partial class Crachas : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnListaCSV_Click(object sender, EventArgs e)
        {
            long random = DateTime.Today.Ticks;
            random += new Random().Next();

            Response.ContentType = "text/csv";
            Response.AddHeader("Content-Disposition", "attachment; filename=\"CrachaAlunos" + random + ".csv\"");

            Response.Clear();
            Response.Write(RelatorioBiz.DadosAlunosParaCrachaEmCSV());
            Response.End();
            Response.Close();
        }
    }
}